#include "StdAfx.h"


TEST(user_pb, repeated)
{
	User user;
	Pair* pair;
	pair = user.add_attributes();
	pair->set_name("name");
	pair->set_value("value");

	Pair* pair2;
	pair2 = user.add_attributes();
	pair2->set_name("name2");
	pair2->set_value("value2");

	EXPECT_EQ("name", user.attributes(0).name());
	EXPECT_EQ("value", user.attributes(0).value());

	EXPECT_EQ("name2", user.attributes(1).name());
	EXPECT_EQ("value2", user.attributes(1).value());
}

TEST(user_pb, escapse)
{
	User user;
	string b = "wd'q)df(2";
	user.set_account(b);
	DBM->escape(*user.mutable_account());
	EXPECT_GT(user.account().size(), b.size());
	EXPECT_NE(b, user.account());
}